package com.example.sjly.sqliteroom;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

@Entity(tableName="users" ,indices={@Index("username")})
public class User {
    @PrimaryKey(autoGenerate = true)
    private int id;

    private String username;//用户名
    private String password;//密码

    private String name;//昵称
    private byte[] portrait;//头像
    private String mail;//邮箱
    private String age;//生日
    private String phone;//手机
    private String school;//学校
    private String region;//地区
    private String Sex;//性别
    @Ignore
    public User() {
    }

    public User(String username, String password, String mail, String phone, String school) {
        this.username = username;
        this.password = password;
        this.mail = mail;
        this.phone = phone;
        this.school = school;
    }

    public void update(int id) {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", mail='" + mail + '\'' +
                ", age=" + age +
                ", phone=" + phone +
                ", school='" + school + '\'' +
                ", region='" + region + '\'' +
                ", Sex='" + Sex + '\'' +
                '}';
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    public byte[] getPortrait() {
        return portrait;
    }

    public void setPortrait(byte[] portrait) {
        this.portrait = portrait;
    }
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }
    public String getSex() {
        return Sex;
    }

    public void setSex(String sex) {
        Sex = sex;
    }


}
